<%@ page import="com.ychs.entity.College" %>
<%@ page import="com.ychs.entity.Major" %>
<%@ page import="com.ychs.entity.Role" %>
<%@ page import="com.ychs.entity.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String username = request.getParameter("username");
    String name = request.getParameter("name");
    String collegeName = request.getParameter("college");
    String majorName = request.getParameter("major");
    String clazz = request.getParameter("clazz");
    String grade = request.getParameter("grade");
    String schoolJob = request.getParameter("schoolJob");
    String phone = request.getParameter("phone");
    String QQ = request.getParameter("QQ");
    String roleName = request.getParameter("role");
    String state = request.getParameter("state");
    String remark = request.getParameter("remark");

    College college = new College();
    college.setName(collegeName);
    Major major = new Major();
    major.setName(majorName);
    Role role = new Role();
    role.setName(roleName);

    User user = new User();
    user.setUsername(username);
    user.setName(name);
    user.setCollege(college);
    user.setMajor(major);
    user.setClazz(clazz);
    user.setGrade(Integer.parseInt(grade));
    user.setSchoolJob(schoolJob);
    user.setPhone(phone);
    user.setQq(QQ);
    user.setRole(role);
    user.setState(state);
    user.setRemark(remark);

    pageContext.setAttribute("user", user);

%>
<div class="layuimini-container">
    <div class="layuimini-main">
<div class="layui-form layuimini-form">
    <form class="layui-form" action="" id="userDetailForm" lay-filter="userDetailFormFilter">
        <div class="layui-form-item">
            <label class="layui-form-label">用户名<span style="color: red">*</span></label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="username" name="username" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">真实姓名<span style="color: red">*</span></label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="name" name="name" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">院系</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="college" name="college" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">专业</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="major" name="major" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">班级</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="clazz" name="clazz" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">年级</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="grade" name="grade" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">在校职务</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="schoolJob" name="schoolJob" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">手机<span style="color: red">*</span></label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="phone" name="phone" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">QQ</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="QQ" name="QQ" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">角色</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="role" name="role" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">用户状态</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"
                       id="state" name="state" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
            <textarea placeholder="请输入备注信息" class="layui-textarea"
                      name="remark" lay-filter="remark" readonly></textarea>
            </div>
        </div>
    </form>

</div>
</div>
</div>

<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        form.render();


        form.val('userDetailFormFilter',{
            "username":'${user.username}',
            "name":'${user.name}',
            "college":'${user.college.name}',
            "major":'${user.major.name}',
            "clazz":'${user.clazz}',
            "grade":'${user.grade}',
            "schoolJob":'${user.schoolJob}',
            "phone":'${user.phone}',
            "QQ":'${user.qq}',
            "role":'${user.role.name}',
            "state":'${user.state}',
            "remark":'${user.remark}',

        })

    });
</script>